import { BrowserRouter as Router, Route, Link } from "react-router-dom";

const First = () => {
  return <div>First组件</div>
}

const App = () => {
  // react-router-dom 使用 5.3.0 版本
  // 核心组件：Router(HashRouter，BrowserRouter) Route Link
  // Router 包裹根组件
  // Link  导航菜单
  return (
    <Router>
      <div className="app">
        <h1>根组件</h1>
      </div>
      <ul>
        <li>
          <Link to="/first">页面一</Link>
          {/* <a href="/first">页面一</a> */}
        </li>
        <li>
          <Link to="/search">搜索</Link>
        </li>
      </ul>
      {/* 路由规则 */}
      <Route path="/first" component={First}></Route>
    </Router>
  );
};

export default App;
